home *** CD-ROM | disk | FTP | other *** search
/ Archive Magazine CD 1995 / Archive Magazine CD 1995.iso / discs / prog_disc / volume_5 / issue_05 / pipeline / Trendy / ReadMe next >
Encoding:
Text File  |  1992-01-12  |  2.0 KB  |  52 lines

  1. %OP%VS4.11 (04-Dec-91), Gerald Lewis Fitton, R4000 5065 0380 9644 
  2. %OP%DP0
  3. %OP%IRY
  4. %OP%PL0
  5. %OP%HM0
  6. %OP%FM0
  7. %OP%BM0
  8. %OP%LM4
  9. %OP%FX
  10. %OP%FY
  11. %OP%FS
  12. %OP%PT1
  13. %OP%PDPipeLine
  14. %OP%WC834,2070,164,1620,0,0,0,0
  15. %CO:A,72,72%
  16. %C%The Trend Function
  17. %C%by Gerald L Fitton
  18. Keywords:
  19. Trend Linest Transpose Set_Value Fitton
  20.  
  21. The Trend(,) function
  22. Some of you have had problems understanding Trend(,) in the PD4 
  23. reference manual.  The syntax for this function is correctly given as 
  24. Trend(Linest,x_data) but you are not told the nature of the arguments.  
  25. Linest is a row vector such as {1,2} representing the line y = 2x + 1; 
  26. in its most general form, Linest is {c,m} and its arguments are the c 
  27. and m of the straight line y = mx + c.  The second argument of Trend(,) 
  28. which I have called x_data, is a row vector of values of x.  The 
  29. function Trend(,) returns a row vector 'hidden' in the one slot 
  30. containing the values of y returned by the formula y = mx + c for the 
  31. corresponding values of x.
  32.  
  33. The problem most of you have had is that you have used a column of data 
  34. for the x values and Trend(,) will not accept a column vector for the 
  35. x_data argument.  The easiest way around this problem is to use the 
  36. function Transpose().  For example if the x data is in the column A3A9 
  37. then Trend({1,2},Transpose(A3A9)) will return a row vector with the 
  38. values of y corresponding to y = 2x + 1.
  39.  
  40. As a final example, suppose you have x data in A3A9, the corresponding 
  41. scattergraph y data in B3B9 and you want to output into C3C9 the values 
  42. of y on the line of best fit corresponding to the range A3A9 of x data.  
  43. To do this you enter the following rather long function in slot C3:
  44.  
  45. set_value(C3C9,transpose(trend(linest(B3B9,A3A9),transpose(A3A9))))
  46.  
  47. I have included a simple example which includes this formula on the 
  48. Archive monthly disc.  By the way, in column D I have calculated the 
  49. variances and in slot D11 I have used array multiplication to find the 
  50. residual sum of squares using the formula Sum(D3D9*D3D9).  Please let 
  51. me know how you get on!
  52.